

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>党建红云</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/assets/css/layui.css" media="all">
  <link rel="stylesheet" href="/assets/css/admin.css"  media="all">
  <link rel="stylesheet" href="/assets/css/login.css"  media="all">
  <style>
  #login_f {
   // background: url(/assets/img/main_bg.png) repeat;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    float: none;
    border-radius: 8px;
}
body{
background-color: rgb(151, 35, 39);
}
.layadmin-user-login {
	//padding:40px 0;
	padding-top:3%;
}
  </style>
</head>
<body >
 <!--<div style="background-color:white;height:80px">
<div class="layadmin-user-login-box layadmin-user-login-header" >
        <h2 style="color:black;font-size:28px">党建红云</h2>
       
      </div>
</div>-->
  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login"  >
	<div  style=" width:870px; height:494px; margin: 0 auto;background:url(/assets/images/00.gif) no-repeat">
    <div class="layadmin-user-login-main" style="padding-top:200px">
     
      <div id="login_f" class="layadmin-user-login-box layadmin-user-login-body layui-form"  >
	  <form id="userLogin" method="post">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="text" name="account" id="user-name" lay-verify="required" placeholder="用户名" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="password" id="password" lay-verify="required" placeholder="密码" class="layui-input">
        </div>
        <div class="layui-form-item">
          <div class="layui-row">
            <div class="layui-col-xs7">  <!---lay-verify="required"--->
              <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
              <input type="text" name="code" id="code"  lay-verify="required" placeholder="图形验证码" class="layui-input">
            </div>
            <div class="layui-col-xs5">
              <div style="margin-left: 10px;">
                <img src="/user/code.do"  class="layadmin-user-login-codeimg" id="LAY-user-get-vercode" onclick="vercodeChange()">
              </div>
            </div>
          </div>
        </div>
       <!-- <div class="layui-form-item" style="margin-bottom: 20px;">
          <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
          <a href="forget.html"  class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
        </div>-->
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" style="background-color:rgb(151, 35, 39)">登 入</button>
        </div>
       </form>
      </div>
    </div>
    </div>
  <!--  <div class="layui-trans layadmin-user-login-footer" >
      
      <p>© 2018 中国电信海南公司</p>
     
    </div>-->
   
  </div>

  <script src="/assets/js/layui.js"></script>
<script src="/assets/js/jquery.js"></script>     
 <script>
 var layer ;
  layui.config({
    base: '/assets/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'laydate'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
   
    ,laydate = layui.laydate
    ,form = layui.form;
	 layer = layui.layer;
    
    form.render(null, 'component-form-group');

    laydate.render({
      elem: '#LAY-component-form-group-date'
    });
   

    
    /* 监听提交 */
    form.on('submit(LAY-user-login-submit)', function(data){
		subLogin();
      /*parent.layer.alert(JSON.stringify(data.field), {
        title: '最终的提交信息'
      })*/
      return false;
    });
  });
  
  function subLogin(){
  var data =  $("#userLogin").serialize();

 $.ajax({  
            url:"/user/login.do",  
            type:"post",  
            dataType:"json",  
            data:data,  
            success:function(rs){  
             
			  
			  if(rs.code=="0"){
			    window.location.href = "index.html";
			  }else if(rs.code==4){
				//alert("验证码错误");
				layer.alert("验证码错误");
				 vercodeChange();
				
			  }else{
			   //alert("用户名或密码错误");
			   layer.alert("用户名或密码错误");
			    vercodeChange();
			  }
            },  
            error:function() {  
            }  
        }); 
  }
  
  
   function vercodeChange(){
          var img = document.getElementById("LAY-user-get-vercode");
           img.src = "/user/code.do?"+Math.random();
}
  </script>
</body>
</html>